package com.xrkol.sharelib.util;

import java.util.List;
import java.util.Map;

import org.springframework.web.servlet.ModelAndView;

import com.google.common.collect.Maps;

public class Renders {

	public static <T> ModelAndView render(String view, String key,List<T> list) {
		Map<String,List<T>> map=Maps.newHashMap();
		map.put(key, list);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t) {
		Map<String,T> map=Maps.newHashMap();
		map.put(key, t);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2) {
		Map<String,T> map=Maps.newHashMap();
		map.put(key, t);
		map.put(key2, t2);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2, String key3,T t3) {
		Map<String,T> map=Maps.newHashMap();
		map.put(key, t);
		map.put(key2, t2);
		map.put(key3, t3);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2, String key3,T t3,String key4,T t4) {
		Map<String,T> map=Maps.newHashMap();
		map.put(key, t);
		map.put(key2, t2);
		map.put(key3, t3);
		map.put(key4, t4);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2, String key3,T t3,String key4,T t4,String key5,T t5) {
		Map<String,T> map=Maps.newHashMap();
		map.put(key, t);
		map.put(key2, t2);
		map.put(key3, t3);
		map.put(key4, t4);
		map.put(key5, t5);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2, String key3,T t3,String key4,T t4,String key5,T t5,String key6,T t6) {
		Map<String,T> map=Maps.newHashMap();
		map.put(key, t);
		map.put(key2, t2);
		map.put(key3, t3);
		map.put(key4, t4);
		map.put(key5, t5);
		map.put(key6, t6);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2, String key3,T t3,String key4,T t4,
	        String key5,T t5,String key6,T t6,String key7,T t7) {
        Map<String,T> map=Maps.newHashMap();
        map.put(key, t);
        map.put(key2, t2);
        map.put(key3, t3);
        map.put(key4, t4);
        map.put(key5, t5);
        map.put(key6, t6);
        map.put(key7, t7);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2, String key3,T t3,String key4,T t4,
            String key5,T t5,String key6,T t6,String key7,T t7,String key8,T t8) {
        Map<String,T> map=Maps.newHashMap();
        map.put(key, t);
        map.put(key2, t2);
        map.put(key3, t3);
        map.put(key4, t4);
        map.put(key5, t5);
        map.put(key6, t6);
        map.put(key7, t7);
        map.put(key8, t8);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2, String key3,T t3,String key4,T t4,
            String key5,T t5,String key6,T t6,String key7,T t7,String key8,T t8,String key9,T t9) {
        Map<String,T> map=Maps.newHashMap();
        map.put(key, t);
        map.put(key2, t2);
        map.put(key3, t3);
        map.put(key4, t4);
        map.put(key5, t5);
        map.put(key6, t6);
        map.put(key7, t7);
        map.put(key8, t8);
        map.put(key9, t9);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2, String key3,T t3,String key4,T t4,
            String key5,T t5,String key6,T t6,String key7,T t7,String key8,T t8,String key9,T t9,String key10,T t10) {
        Map<String,T> map=Maps.newHashMap();
        map.put(key, t);
        map.put(key2, t2);
        map.put(key3, t3);
        map.put(key4, t4);
        map.put(key5, t5);
        map.put(key6, t6);
        map.put(key7, t7);
        map.put(key8, t8);
        map.put(key9, t9);
        map.put(key10, t10);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, String key,T t, String key2,T t2, String key3,T t3,String key4,T t4,
            String key5,T t5,String key6,T t6,String key7,T t7,String key8,T t8,String key9,T t9,String key10,T t10,
            String key11,T t11) {
        Map<String,T> map=Maps.newHashMap();
        map.put(key, t);
        map.put(key2, t2);
        map.put(key3, t3);
        map.put(key4, t4);
        map.put(key5, t5);
        map.put(key6, t6);
        map.put(key7, t7);
        map.put(key8, t8);
        map.put(key9, t9);
        map.put(key10, t10);
        map.put(key11, t11);
        return new ModelAndView(view,map);
    }
	
	public static <T> ModelAndView render(String view, Map<String,T> modelMap) {
		return new ModelAndView(view,modelMap);
    }

}
